﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameOfLife
{
    class Foo<T> where T:class 
    {
        private T _input;

        public Foo(T input)
        {
            Input = input;
        }

        public T Input
        {
            get { return _input; }
            set { _input = value; }
        }

        public override string ToString()
        {
            return _input.ToString();
        }

        public override bool Equals(object obj)
        {
            T tmp = obj as T;
            if(tmp==null) return false;
            
            return _input.Equals(tmp);
        }

        public bool Equals(Foo<T> other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other._input, _input);
        }

        public override int GetHashCode()
        {
            return (_input != null ? _input.GetHashCode() : 0);
        }
    }
}
